package org.example.dao;

import org.example.domain.User;
import org.example.orm.annotation.Delete;
import org.example.orm.annotation.Insert;
import org.example.orm.annotation.Select;
import org.example.orm.annotation.Update;

import java.util.List;

/**
 * @author hsc
 * @date 2024-02-18
 * @Description 基代理对象的方式实现dao, 注解方式,
 */
public interface UserDaoByAnnotation {

    @Insert("insert into users values(#{uid},#{uname},#{upass})")
    public void insert(User user);

    @Delete("delete from users where uid = #{uid}")
    public void deleteUser(int uid);

    @Update("update users set uname=#{uname},upass=#{upass} where uid=#{uid}")
    public void updateUser(User user);

    @Select("select * from users where uid = #{uid}")
    public User selectOne(int uid);

    @Select("select * from users")
    public List<User> selectList();


}
